package crivia.ecp.carry.eb;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import crivia.ecp.carry.em.TopButton;

public class TopTitle {
	
	public TopTitle() {
		super();
	}
	
	public TopTitle(String name) {
		super();
		this.name = name;
	}

	public TopTitle(String name, String imageFile) {
		super();
		this.name = name;
		this.imageFile = imageFile;
	}

	public final static String ImageFile_Crm = "/images/hdCRM.gif";
	public final static String ImageFile_CrmAccount = "/images/hdCRMAccount.gif";
	public final static String ImageFile_CrmSearch = "/images/hdCRMSearch.gif";
	public final static String ImageFile_Doc = "/images/hdDOC.gif";
	public final static String ImageFile_DocSearch = "/images/hdDOCSearch.gif";
	public final static String ImageFile_Error = "/images/hdError.gif";
	public final static String ImageFile_Fin = "/images/hdFIN.gif";
	public final static String ImageFile_FinSearch = "/images/hdFINSearch.gif";
	public final static String ImageFile_Help = "/images/hdHelp.gif";
	public final static String ImageFile_Hrm = "/images/hdHRM.gif";
	public final static String ImageFile_HrmCard = "/images/hdHRMCard.gif";
	public final static String ImageFile_HrmSearch = "/images/hdHRMSearch.gif";
	public final static String ImageFile_Log = "/images/hdLOG.gif";
	public final static String ImageFile_LogSearch = "/images/hdLOGSearch.gif";
	public final static String ImageFile_Mail = "/images/hdMail.gif";
	public final static String ImageFile_Maintenance = "/images/hdMaintenance.gif";
	public final static String ImageFile_NoAccess = "/images/hdNoAccess.gif";
	public final static String ImageFile_Organization = "/images/hdOrganization.gif";
	public final static String ImageFile_Prj = "/images/hdPRJ.gif";
	public final static String ImageFile_PrjSearch = "/images/hdPRJSearch.gif";
	public final static String ImageFile_PrjSpecific = "/images/hdPRJSpecific.gif";
	public final static String ImageFile_Prm = "/images/hdPRM.gif";
	public final static String ImageFile_PrmWorkFlow = "/images/hdPRMWorkFlow.gif";
	public final static String ImageFile_Report = "/images/hdReport.gif";
	public final static String ImageFile_Search = "/images/hdSearch.gif";
	public final static String ImageFile_System = "/images/hdSystem.gif";
	
	public final static Set<String> allImages = new HashSet<String>();
	static {
		allImages.add(ImageFile_Crm);
		allImages.add(ImageFile_Crm);
		allImages.add(ImageFile_CrmAccount);
		allImages.add(ImageFile_CrmSearch);
		allImages.add(ImageFile_Doc);
		allImages.add(ImageFile_DocSearch);
		allImages.add(ImageFile_Error);
		allImages.add(ImageFile_Fin);
		allImages.add(ImageFile_FinSearch);
		allImages.add(ImageFile_Help);
		allImages.add(ImageFile_Hrm);
		allImages.add(ImageFile_HrmCard);
		allImages.add(ImageFile_HrmSearch);
		allImages.add(ImageFile_Log);
		allImages.add(ImageFile_LogSearch);
		allImages.add(ImageFile_Mail);
		allImages.add(ImageFile_Maintenance);
		allImages.add(ImageFile_NoAccess);
		allImages.add(ImageFile_Organization);
		allImages.add(ImageFile_Prj);
		allImages.add(ImageFile_PrjSearch);
		allImages.add(ImageFile_PrjSpecific);
		allImages.add(ImageFile_Prm);
		allImages.add(ImageFile_PrmWorkFlow);
		allImages.add(ImageFile_Report);
		allImages.add(ImageFile_Search);
		allImages.add(ImageFile_System);
	}
	
	private boolean enable = true; 
	
	private String name = "";
	
	private String imageFile = ImageFile_Maintenance;
	
	private boolean help = false;

	public boolean isEnable() {
		return enable;
	}

	public TopTitle setEnable(boolean enable) {
		this.enable = enable;
		return this;
	}

	public String getName() {
		return name;
	}

	public TopTitle setName(String name) {
		this.name = name;
		return this;
	}

	public String getImageFile() {
		return imageFile;
	}

	public TopTitle setImageFile(String imageFile) {
		this.imageFile = imageFile;
		return this;
	}

	public String help() {
		return help ? "1" : "0";
	}

	public boolean isHelp() {
		return help;
	}

	public TopTitle setHelp(boolean help) {
		this.help = help;
		return this;
	}

	private List<TopButton> topButtons = new ArrayList<TopButton>();
	public List<TopButton> getTopButtons() {
		return topButtons;
	}
	public TopButton getTopButton(int index) {
		return topButtons.get(index);
	}
	public TopTitle setTopButtons(List<TopButton> topButtons) {
		this.topButtons = topButtons;
		return this;
	}
	public TopTitle addTopButton(TopButton topButton) {
		topButtons.add(topButton);
		return this;
	}
	public TopTitle addTopButton(String text , String onclick) {
		topButtons.add(new TopButton(text, onclick));
		return this;
	}
	public TopTitle addTopButton(MoreMenu menu) {
		topButtons.add(new TopButton(menu.getName(), menu.getScriptMethod()));
		return this;
	}

}
